package com.xs.dao;

import com.xs.pojo.Log;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface LogDao {

    /**
     * 查询所有
     * @return
     */
    @Select("select * from  b_log")
    List<Log> SelectAll();

    /**
     * 增添
     * @param log
     */
    @Insert("insert into b_log values(null,#{user_name},#{sex},#{home},#{phon},#{head_time},#{end_time})")
    void add(Log log);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from b_log where id=#{id}")
    Log SelectById(int id);


    /**
     * 修改
     * @param log
     */
    @Update("update b_log set user_name=#{user_name}," +
            "sex=#{sex},home=#{home},phon=#{phon},head_time=#{head_time},end_time=#{end_time} where id = #{id}")
    void Updata(Log log);

    /**
     * 删除
     * @param id
     */
    @Delete("delete from b_log where id=#{id}")
    void Delete(Integer id);


    /**
     * 根据条件查询总
     * @return
     */
    List<Log> selectCondition(Log log);
}
